#ifndef __USER_UTILS_H__
#define __USER_UTILS_H__

#include "esp_err.h"
#include <stdbool.h>
#include <stdint.h>

#define SOFT_VER "1.0.1"
#define HARD_VER "1.0.0"
#define IS_RELEASE false

typedef enum {
    media_IDLE = 0,
    media_recording, // 录音 无VAD检测
    media_recognize, // 识别
    media_vedio,     // 视频
} media_state_t;

typedef struct {
    uint8_t mac[6];
    uint16_t SAddr;

    char sn[20];
    char SAddr_str[5];
    char deviceName[20];

    uint8_t bat;

    struct {
        char ssid[32];
        char password[64];
        bool enable;
        bool connState;
        bool httpServer;
    } wifiInfo;

    struct {
        uint8_t mac[6];
        char mac_str[18];
        bool enable;
        bool connState;
    } BTInfo;

    struct {
        uint8_t mac[6];
        char mac_str[18];
        bool enable;
        bool connState;
    } BLEInfo;

    struct {
        uint8_t volume;
        uint8_t mic_gain;
        uint8_t speaker_gain;
        media_state_t state;
    } mediaInfo;
} devInfo_t;

extern devInfo_t devInfo;

void update_devInfo(void);
void update_firmware(char *path);
esp_err_t nvs_write(char *key, char *value);
char *get_ip_address(void);

#endif // __USER_UTILS_H__